﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraBars;
using DevExpress.XtraBars;
using DevExpress.UserSkins;
using DevExpress.XtraBars.Helpers;


namespace QLKhachSan.GUI
{
    public partial class fMain : DevExpress.XtraBars.Ribbon.RibbonForm
    {
        private fNhanVien _fNhanVien = new fNhanVien();
        private fDichVu _fDichVu = new fDichVu();
        private fPhong _fPhong = new fPhong();
        private fKhachHang _fKhachHang = new fKhachHang();
        private fDanhSachPhong _fDanhSachPhong = new fDanhSachPhong();

        public fMain()
        {
            InitializeComponent();
        }

        private void fMain_Load(object sender, EventArgs e)
        {
            DevExpress.UserSkins.OfficeSkins.Register();
            DevExpress.UserSkins.BonusSkins.Register();
            SkinHelper.InitSkinPopupMenu(barSubItem1);

        }

        private void navBarItemNhanVien_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (_fNhanVien == null || _fNhanVien.IsDisposed) // Chua Tao or Chua Mo fNhanVien, Tạo Mới fNhanVien
            {
                _fNhanVien = new fNhanVien();
                _fNhanVien.MdiParent = this;
                _fNhanVien.Show();
            }
            else
            {
                _fNhanVien.Close();
                _fNhanVien = new fNhanVien();
                _fNhanVien.MdiParent = this;
                _fNhanVien.Show();
            } // da tao fNhanVien, Dong va tao moi fNhanVien
        }

        private void navBarItemDichVu_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (_fDichVu == null || _fDichVu.IsDisposed) // Chua Tao or Chua Mo fDichVu, Tạo Mới fDichVu
            {
                _fDichVu = new fDichVu();
                _fDichVu.MdiParent = this;
                _fDichVu.Show();
            }
            else
            {
                _fDichVu.Close();
                _fDichVu = new fDichVu();
                _fDichVu.MdiParent = this;
                _fDichVu.Show();
            } // da tao fDichVu, Dong va tao moi fDichVu

        }

        private void navBarItemPhong_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (_fPhong == null || _fPhong.IsDisposed) // Chua Tao or Chua Mo fPhong, Tạo Mới fPhong
            {
                _fPhong = new fPhong();
                _fPhong.MdiParent = this;
                _fPhong.Show();
            }
            else
            {
                _fPhong.Close();
                _fPhong = new fPhong();
                _fPhong.MdiParent = this;
                _fPhong.Show();
            } // da tao fPhong, Dong va tao moi fPhong

        }

        private void navBarItemKhachHang_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (_fKhachHang == null || _fKhachHang.IsDisposed) // Chua Tao or Chua Mo fKhachHang, Tạo Mới fKhachHang
            {
                _fKhachHang = new fKhachHang();
                _fKhachHang.MdiParent = this;
                _fKhachHang.Show();
            }
            else
            {
                _fKhachHang.Close();
                _fKhachHang = new fKhachHang();
                _fKhachHang.MdiParent = this;
                _fKhachHang.Show();
            } // da tao fKhachHang, Dong va tao moi fKhachHang

        }

        private void barButtonItem10_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {

            if (_fDanhSachPhong == null || _fDanhSachPhong.IsDisposed) // Chua Tao or Chua Mo fDanhSachPhong, Tạo Mới fDanhSachPhong
            {
                _fDanhSachPhong = new fDanhSachPhong();
                _fDanhSachPhong.MdiParent = this;
                _fDanhSachPhong.Show();
            }
            else
            {
                _fDanhSachPhong.Close();
                _fDanhSachPhong = new fDanhSachPhong();
                _fDanhSachPhong.MdiParent = this;
                _fDanhSachPhong.Show();
            } 
        }
    }
}